package lee.vioson.remotedata.bean

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey

/**
 *Author:viosonlee
 *Date:2023/6/3
 *DESCRIPTION:
 */
@Entity
data class Book(
    @PrimaryKey val id: String,
    @ColumnInfo val author: String,
    @ColumnInfo val bookName: String,
    @ColumnInfo val bookType: Int,
    @ColumnInfo val briefIntroduction: String,
    @ColumnInfo val chapterCount: Int,
    @ColumnInfo val coverPhoto: String,
    @ColumnInfo val favoritesCount: Int,
    @ColumnInfo val hotCount: Long,
    @ColumnInfo val isComplete: Int,
    @ColumnInfo val isLaunch: Int,
    @ColumnInfo val isVip: Int,
    @ColumnInfo val language: String,
    @ColumnInfo val recommendIndex: Int,
    @ColumnInfo val shareDesc: String,
    @ColumnInfo val sharePhoto: String,
    @ColumnInfo val shareTitle: String,
//    val types: List<String> = listOf(),
//    val marks: List<String> = listOf(),
    @ColumnInfo var isCollection: Boolean = false
) {
    //    val typeString: String
//        get() = StringBuffer().also { stringBuffer ->
//            types.forEach {
//                if (stringBuffer.isEmpty()) {
//                    stringBuffer.append(it)
//                } else {
//                    stringBuffer.append("/").append(it)
//                }
//            }
//        }.toString()

    override fun equals(other: Any?): Boolean {
        return other is Book && other.id == id
    }

    override fun hashCode(): Int {
        return id.hashCode()
    }
}
